package jmine.tec.database.pack;

import java.io.OutputStream;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

import jmine.tec.utils.io.ReversibleOutputStream;

/**
 * Conjunto de arquivos prontos para exportação.
 * 
 * @author lundberg
 */
public class DefaultPack implements Pack {

    private Set<PackElement> elements = new LinkedHashSet<PackElement>();

    /**
     * {@inheritDoc}
     */
    public OutputStream put(String fileCode, String... path) throws PackException {
        ReversibleOutputStream storage = new ReversibleOutputStream();
        this.elements.add(new PackElement(fileCode, storage, path));
        return storage;
    }

    /**
     * {@inheritDoc}
     */
    public Set<PackElement> getElements() {
        return Collections.unmodifiableSet(this.elements);
    }
}
